require("../util.js");
require("../component/components.js");
require("../../jsMt/util.js");
// var userInfo=JSON.parse(localStorage.getItem("userInfo"));
var vm = new Vue({
    el:"#abstractEdit",
    data:{
        txt:"",
        number:300,
        num:0,
        circleId:"",//圈子id
        loginUid:"",//用户id
        memberInfo:{},
        pop: {
            question: "您确定要把TA踢出圈子？",
            show: false
        }
    },
    mounted:function(){
        this.searchObject = this.getQueryStringArgs();
        this.circleId=this.searchObject&&this.searchObject.circleId;
        this.loginUid=this.searchObject&&this.searchObject.uid;
        //this.updateGroupIntroduction();
    },
    methods:{
        //后退
        getBack: function () {
            history.go(-1);
        },
        /*获取查询字符对象*/
        getQueryStringArgs: function () {
            //取得查询字符串并去掉开头的问号
            var qs = (location.search.length > 0 ? location.search.substring(1) : ""),
                args = {},
                items = qs.length ? qs.split("&") : [],
                item = null,
                name = null,
                value = null,
                len = items.length;
            for (var i = 0; i < len; i++) {
                item = items[i].split("=");
                name = item[0];
                value = item[1];
                if (name.length) {
                    args[name] = value;
                }
            }
            return args;
        },
        //解散圈子
        updateGroupIntroduction:function(){
            var that=this;
            var data={
                loginUid:that.loginUid,
                circleId:that.circleId,
                introduction:encodeURI(that.txt)
            };
            console.log(data);
            this.ajax({url:"/friend/updateGroupIntroduction",data:data,dataType:"json",method:"post"},function(b){
                if(b.json.code==0){
                    vm.$refs.prompt.toast("修改简介成功！");
                    history.go(-1);
                }else{
                    vm.$refs.prompt.toast("修改简介失败！");
                }
            });
        }
    },
    watch:{
        txt:function(){
            this.num=this.txt.length;
            //console.log(this.num);
        }
    }
});